repo.or.cz
/
andmenj-acm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Solving 10385 - Duathlon (Ternary search)
[andmenj-acm.git]
/
11843 - Guessing Game
/
11843.cpp
blob
b26edff27561b80066c3dbf504d46707c324ec23
1
// Wrong Answer
2
using namespace
std
;
3
#include <algorithm>
4
#include <iostream>
5
#include <iterator>
6
#include <numeric>
7
#include <sstream>
8
#include <fstream>
9
#include <cassert>
10
#include <climits>
11
#include <cstdlib>
12
#include <cstring>
13
#include <string>
14
#include <cstdio>
15
#include <vector>
16
#include <cmath>
17
#include <queue>
18
#include <deque>
19
#include <stack>
20
#include <list>
21
#include <map>
22
#include <set>
23
24
#define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
25
#define For(i, a, b) for (int i=(a); i<(b); ++i)
26
#define D(x) cout << #x
" is "
<< x << endl
27
28
int
main
(){
29
int
C
;
30
cin
>>
C
;
31
while
(
C
--) {
32
int
n
,
s
;
33
cin
>>
n
>>
s
;
34
int
ans
=
0
;
35
while
(
n
>
0
) {
36
if
(
s
>
1
) {
37
n
/=
2
;
38
s
--;
39
}
else
{
40
n
--;
41
}
42
ans
++;
43
}
44
printf
(
"%d
\n
"
,
ans
);
45
}
46
return
0
;
47
}